// ignore_for_file: file_names

import 'package:flutter/material.dart';

class MyApp11 extends StatelessWidget {
  const MyApp11(
      {super.key,
      this.title = '',
      this.content = '',
      this.textCol = Colors.black,
      this.textSize = 0});

  final String title;
  final String content;
  final Color textCol;
  final double textSize;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.orange,
          toolbarHeight: 100,
          title: Center(
            child: Text(
              '$title ',
              style: const TextStyle(color: Colors.white, fontSize: 50),
            ),
          ),
        ),
        body: const MyContainer(),
      ),
    );
  }
}

class MyContainer extends StatelessWidget {
  const MyContainer({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
      itemBuilder: (BuildContext context, int index) {
        return Container(
          padding: const EdgeInsets.all(20),
          height: 200,
          color: Colors.yellow,
          child: Text(
            '$index',
            style: const TextStyle(fontSize: 50),
          ),
        );
      },
      separatorBuilder: (BuildContext context, int index) {
        return Container(
          height: 20,
          color: Colors.grey,
          child:
              const Text('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'),
        );
      },
      itemCount: 500,
    );
  }
}

class MyContainer_build extends StatelessWidget {
  const MyContainer_build({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView.builder(itemBuilder: (BuildContext context, int index) {
      return Container(
        padding: const EdgeInsets.all(20),
        height: 200,
        color: Colors.yellow,
        child: Text(
          '$index',
          style: const TextStyle(fontSize: 50),
        ),
      );
    });
  }
}

class MyContainer_normal extends StatelessWidget {
  const MyContainer_normal({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView(
      scrollDirection: Axis.vertical,
      // 禁止滚动
      physics: const NeverScrollableScrollPhysics(),
      children: [
        Container(
          height: 200,
          color: Colors.red,
        ),
        Container(
          height: 200,
          color: Colors.orange,
        ),
        Container(
          height: 200,
          color: Colors.yellow,
        ),
        Container(
          height: 200,
          color: Colors.green,
        ),
        Container(
          height: 200,
          color: Colors.greenAccent,
        ),
        Container(
          height: 200,
          color: Colors.blue,
        ),
        Container(
          height: 200,
          color: Colors.purple,
        ),
      ],
    );
  }
}
